﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage/Admin.Master"
    CodeBehind="Dashboard.aspx.vb" Inherits="GoodAnotApp.Dashboard1" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel ID="Panel1" runat="server">
        <div>
            <table width="100%">
                <tr>
                    <td height="600px">
                        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSourceDashboard"
                            GridLines="None" Height="217px" Skin="Office2007" Width="565px" 
                            CellSpacing="0">
                            <MasterTableView AutoGenerateColumns="False" DataKeyNames="report_ID" DataSourceID="SqlDataSourceDashboard">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="report_ID" DataType="System.Int32" DefaultInsertValue=""
                                        HeaderText="ID" ReadOnly="True" SortExpression="report_ID" UniqueName="report_ID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="priority" DataType="System.Int32" DefaultInsertValue=""
                                        HeaderText="Priority" SortExpression="priority" UniqueName="priority">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="type" DefaultInsertValue="" HeaderText="Type"
                                        SortExpression="type" UniqueName="type">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" DefaultInsertValue=""
                                        Display="False" HeaderText="ID" SortExpression="ID" UniqueName="ID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="comment" DefaultInsertValue="" HeaderText="comment"
                                        SortExpression="comment" UniqueName="comment">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridButtonColumn Text="resolve" UniqueName="column1" CommandName="resolve">
                                    </telerik:GridButtonColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                        </td>
                    <td height="600px">
                        <asp:Panel ID="Panel3" runat="server">
                            <asp:TextBox ID="tbxName" runat="server"></asp:TextBox>
                            <asp:DropDownList ID="DropDownList1" runat="server">
                                <asp:ListItem>Email Address</asp:ListItem>
                                <asp:ListItem>Display Name</asp:ListItem>
                            </asp:DropDownList>
                            <asp:Button ID="btnSearch" runat="server" Text="Search" />
                            &nbsp;<asp:Label ID="lblError" runat="server" ForeColor="Red" Text="Label" 
                                Visible="False"></asp:Label>
                            <br />
                            <asp:GridView ID="GridView2" runat="server">
                                <Columns>
                                    <asp:ButtonField CommandName="Promote" Text="Promote" />
                                    <asp:ButtonField CommandName="Demote" Text="Demote" />
                                </Columns>
                            </asp:GridView>
                            <br />
                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>" 
                                SelectCommand="SELECT email, display_name, first_name, last_name, is_admin FROM user_account WHERE (email LIKE @email + '%')" 
                                
                                UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="tbxName" Name="email" PropertyName="Text" />
                                </SelectParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="is_admin" />
                                    <asp:Parameter Name="email" />
                                </UpdateParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>" 
                                SelectCommand="SELECT [email], [display_name], [first_name], [last_name], [is_admin] FROM [user_account] WHERE ([display_name] LIKE @display_name + '%')" 
                                
                                UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="tbxName" Name="display_name" 
                                        PropertyName="Text" Type="String" />
                                </SelectParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="is_admin" />
                                    <asp:Parameter Name="email" />
                                </UpdateParameters>
                            </asp:SqlDataSource>
                            <br />
                        </asp:Panel>
                        <asp:SqlDataSource ID="SqlDataSourceDashboard" runat="server" ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>"
                            SelectCommand="SELECT [report_ID], [priority], [type], [ID], [comment] FROM [dashboard_report] WHERE ([resolved] = @resolved)">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="0" Name="resolved" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td height="600px">
                        &nbsp;
                    </td>
                    <td height="600px">
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server">
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>" SelectCommand="SELECT email, display_name, first_name, last_name, is_admin FROM user_account WHERE (email LIKE @email + '%')"
            
            UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
            <SelectParameters>
                <asp:ControlParameter ControlID="tbxName" Name="email" PropertyName="Text" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="is_admin" />
                <asp:Parameter Name="email" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>" SelectCommand="SELECT [email], [display_name], [first_name], [last_name], [is_admin] FROM [user_account] WHERE ([display_name] LIKE @display_name + '%')"
            
            UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
            <SelectParameters>
                <asp:ControlParameter ControlID="tbxName" Name="display_name" PropertyName="Text"
                    Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="is_admin" />
                <asp:Parameter Name="email" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />
    </asp:Panel>
</asp:Content>
